<?php
namespace Admin\Controller;
use Think\Controller;
use Admin\Api\AdminUserApi;
class LoginController extends Controller {
	  //登陆页呈现
    public function index(){

    		$this->display();
    }
    //注销
    public function lgout(){
    		
    	
    }
    //登录用户名密码核对
    public function check(){
        if(IS_POST){
            $usernamer = I('post.username','');
            $map['username'] = $usernamer;
            $pwd = I('post.password','');
            $res = apiCall(AdminUserApi::GET_INFO,array($map));

            if($res['status']){
                if(md5($pwd) == $res['info']['password']){
                    session("uid", $res['id']);
                    $this->success('登陆成功',U('Index/index'));
                }else{
                    $this->error('密码错误');
                }
            }else{
                $this->erro('用户名或者密码错误');
            }
        }else{
            $this->error('提交方式出现错误');
        }
    	
    }
}